package com.zzyl.mapper;

import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.vo.NursingProjectPlanVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface NursingProjectPlanMapper {

    /**
     * 新增护理计划时的多个中间表
     * @param nursingProjectPlan
     */
    void insert(List<NursingProjectPlan> nursingProjectPlan);

    /**
     * 根据plan_id查询中间表
     * @param planId
     * @return
     */
    List<NursingProjectPlanVo> getByPlanId(Long planId);

    /**
     * 根据plan_id修改中间表
     * @param nursingProjectPlan
     */
    void update(NursingProjectPlan nursingProjectPlan);

    /**
     * 修改护理计划时，先删除中间表
     * @param planId
     */
    @Delete("delete from nursing_project_plan where plan_id =#{planId}")
    void deleteByPlanId(Long planId);

    /**
     * 根据ID删除中间表
     * @param id
     * @return
     */
    @Delete("delete from nursing_project_plan where id = #{id}")
    void deleteById(Long id);
}
